programming4us
           
 
 
Windows Phone

Windows Phone 8 : Phone Hardware - Using Motion (part 2) - Emulating Motion

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
6/28/2013 7:54:36 PM

Emulating Motion

When developing an application that takes advantage of the accelerometer, you can debug directly on a real device if that makes the most sense. Otherwise, you can use the emulator to emulate motion for your development. The emulator has a button on the control bar to show a separate window with support for motion and location emulation. To show this additional window, you have to click the right-arrow icon on the control bar of the emulator, as shown in Figure 2.

Image

FIGURE 2 Showing the Accelerometer window in the emulator

Clicking that button opens a window with an Accelerometer tab and a Location tab. To emulate motion, you will use the Accelerometer tab, as shown in Figure 3.

Image

FIGURE 3 The Accelerometer window

You should notice the image of a phone floating in space on the Accelerometer tab. In the middle of the phone is a pink circle you can grab with your mouse to move it in 3D space. As you do that, the accelerometer values change (shown as X, Y, and Z in the lower left). This will enable you to see the relative axis values as you move the phone.

In the bottom-left area of the window is an Orientation drop-down where you can change your perspective to the phone. For example, if you change the orientation to Portrait Flat, you’ll still see the phone, but it will be from the perspective of the phone lying flat on a table.

Finally, in the bottom-right area of the window is the Recorded Data drop-down that contains prerecorded sets of accelerometer data that you can run. By default, the only recorded data included is Shake, which emulates someone shaking the phone for a few seconds.

Creating Recorded Data

You can add your recorded data to the emulator by creating a simple XML file and dropping it into the emulator’s accelerometer sensor data directory. The directory is as follows:

%PROGFILES%\Microsoft XDE\8.0\sensordata\acc

The XML files are labeled with the name you want to appear in the drop-down list (for instance, “Shimmy” with no extension for the Shake data file). The format of this XML file is shown here:

<?xml version="1.0" encoding="utf-8"?>
<WindowsPhoneEmulator
xmlns="http://schemas.microsoft.com/WindowsPhoneEmulator/2009/08/
SensorData">
  <SensorData>
    <Header version="1"/>
    <AccData offset="1000" x="1" y="0" z="0" />
    <AccData offset="2000" x="-1" y="0" z="0" />
    <AccData offset="3000" x="0" y="-1" z="0" />
  </SensorData>
</WindowsPhoneEmulator>

The important part of the format is the SensorData section. After the Header element is a list of AccData elements that contain the axis values as the number of milliseconds after the start of the recording to change the value to. This example moves the axis values after per second, but for something more complex you might need to change the values much more often than that. The Shake offsets change the values every few milliseconds to mimic the Shake action.

Other -----------------
- Microsoft XNA Game Studio 3.0 : Adding Bread to Your Game (part 3) - Strange Bounce Behavior, Strange Edge Behavior
- Microsoft XNA Game Studio 3.0 : Adding Bread to Your Game (part 2) - Improving Programs Using Methods, Handling Collisions
- Microsoft XNA Game Studio 3.0 : Adding Bread to Your Game (part 1) - Using a Structure to Hold Sprite Information, Using the Gamepad Thumbsticks to Control Movement
- Business Apps for Android & Windows Phone 7 : Handyscan, Outdoor Navigation, Pageonce Money& Bills, Glympse, Cool Tools
- Windows Phone 7 Game Development : Orthographic Projection (part 2) - Isometric Projection & Pixel-Aligned Projection
- Windows Phone 7 Game Development : Orthographic Projection (part 1) - The Viewing Frustum & Defining the Orthographic Viewing Frustum in XNA
- Windows Phone 7 Game Development : Lighting (part 3) - Adding Lighting to Games
- Windows Phone 7 Game Development : Lighting (part 2) - How XNA Calculates Light Reflections
- Windows Phone 7 Game Development : Lighting (part 1) - Types of Illumination
- Windows Phone 7 : User Interface - Using Panorama and Pivot Controls
- Windows Phone 7 : User Interface - Localizing Your Application
- User Interface : Using the Windows Phone 7 Predefined Styles
- Handling Input on Windows Phone 7 : Touch Input (part 3) - Multi-Point Touch
- Handling Input on Windows Phone 7 : Touch Input (part 2) - Raw Touch with Mouse Events
- Handling Input on Windows Phone 7 : Touch Input (part 1) - Single-Point Touch
- Handling Input on Windows Phone 7 : The Keyboard
- User Interface : Customizing the Soft Input Panel Keyboard to Accept Only Numbers
- User Interface : Detecting Changes in the Theme Template
- Developing for Windows Phone and Xbox Live : Multiplayer Games (part 6) - Searching for an Available Network Session
- Developing for Windows Phone and Xbox Live : Multiplayer Games (part 5) - Searching for an Available Network Session
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us